import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:nyh_motorcade_app/styles/colors.dart';
import 'main_controller.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class MainPage extends StatelessWidget {
  final controller = Get.put(MainController());

  @override
  Widget build(BuildContext context) {
    return GetBuilder<MainController>(
      builder: (controller) {
        return Scaffold(
          bottomNavigationBar: BottomNavigationBar(
            items: [
              BottomNavigationBarItem(
                label: "首页",
                icon: Image.asset("images/ic_home_${controller.currentIndex == 0 ? "selected" : "unselect"}.png"),
              ),
              // BottomNavigationBarItem(
              //   label: "报表",
              //   icon: Image.asset("images/ic_report_forms_${controller.currentIndex == 1 ? "selected" : "unselect"}.png"),
              // ),
              BottomNavigationBarItem(
                label: "我的",
                icon: Image.asset("images/ic_my_${controller.currentIndex == 1 ? "selected" : "unselect"}.png"),
              ),
            ],
            currentIndex: controller.currentIndex,
            type: BottomNavigationBarType.fixed,
            selectedFontSize: 10.sp,
            unselectedFontSize: 10.sp,
            selectedItemColor: Colours.color_theme,
            unselectedItemColor: Colours.color_d5dbe5,
            onTap: (index) {
              controller.setCurrentIndex(index);
            },
          ),
          body: PageView.builder(
            itemCount: controller.pageList.length,
            controller: controller.pageController,
            physics: NeverScrollableScrollPhysics(),
            itemBuilder: (context, index) => controller.pageList[index],
          ),
        );
      },
    );
  }
}
